
#静态库和动态库的名字
LIBNAME=myfile

#指定库文件和头文件的安装路径
INSTPATH=`pwd`/../lib/
CFLAGS+=-I${INSTPATH}
#LDFLAGS+=-L${INSTPATH}

#定义编译器
CC=gcc
AR=ar

all:dynamic_lib
	@make install
	@make clear

#生成动态库
dynamic_lib:
	${CC} -shared -fPIC *.c -o lib${LIBNAME}.so ${CFLAGS}

#编译生成的库文件移到lib下
install:
	cp -rf lib${LIBNAME}.* ${INSTPATH}
	
clear:
	rm -f *.o

clean:clear
	rm -f lib${LIBNAME}.*

